{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#encoding=utf8\n",
      "import pymongo\n",
      "import simhash \n",
      "\n",
      "Article = pymongo.Connection().stock.Article\n",
      "\n",
      "\n",
      "def pr(t):\n",
      "    print json.dumps(t, ensure_ascii=False,indent=2)\n",
      "id=0\n",
      "bu = simhash.SimhashIndex({},k=50)\n",
      "for i in Article.find({},{\"_id\":1,\"sim\":1}).limit(10000):\n",
      "    obj_id = i['_id']\n",
      "    hash_int = simhash.Simhash(int(i['sim']))\n",
      "    bu.add( obj_id,hash_int)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 35
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "bu.k=13\n",
      "for item in Article.find().limit(10):\n",
      "    obj_id = str(item['_id'])\n",
      "    sim = simhash.Simhash(int(item['sim']))\n",
      "#     print sim,\n",
      "    articles = bu.get_near_dups(sim)\n",
      "    print item['title'],item['_id']\n",
      "    for i in articles:\n",
      "        if i==obj_id:continue\n",
      "        art = Article.find_one({\"_id\":bson.objectid.ObjectId(i)})\n",
      "        print '\\t',art['title'],art['_id'],art['url']"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(5/15)\u5341\u5927\u535a\u6587\u7cbe\u7cb9\uff1a\u4e09\u8fde\u9634\u540e\u5c06\u5982\u4f55\u6f14\u53d8\uff1f 5374c1267f949f34902c46f1\n",
        "\t\u201c\u7164\u98de\u8272\u821e\u201d\u96be\u6301\u7eed \u954d\u4ef7\u4ecd\u6709\u51b2\u9ad8\u673a\u4f1a 5375bc937f949f4338bf4fac http://stock.eastmoney.com/news/1406,20140516384842677.html\n",
        "\t\u5341\u5927\u673a\u6784\u9884\u6d4b\u5927\u52bf\uff1a\u5411\u4e0b\u8003\u9a8c2000\u70b9\u652f\u6491 5375bc6a7f949f4338bf4f1f http://stock.eastmoney.com/news/1406,20140516385024414.html\n",
        "\t\u66dd\u5b8b\u536b\u5e73\u9000\u51fa\u7eff\u57ce\u4e2d\u56fd \u9a6c\u4e91\u4e2a\u4eba\u8eab\u4efd\u6536\u8d2d\u7403\u961f 5375bca67f949f4338bf4ff4 http://stock.eastmoney.com/news/1532,20140516384860773.html\n",
        "\u8010\u5fc3\u4f4e\u5438\u4e09\u7c7b\u80a1 5374c12c7f949f34902c46fd\n",
        "\t\u8dcc\u8dcc\u4e0d\u4f11\u4f55\u65f6\u4e86\uff1f 5375bcad7f949f4338bf500b http://stock.eastmoney.com/news/1413,20140516384994118.html\n",
        "\t\u4e16\u754c\u6700\u5927\u84dd\u94bb2400\u4e07\u7f8e\u5143\u62cd\u51fa \u884c\u5bb6\u79f0\u662f\u6781\u54c1(\u56fe) 5374c1837f949f34902c4810 http://stock.eastmoney.com/news/1406,20140515384652597.html\n",
        "\t\u90e8\u5206\u4ea7\u54c1\u5df2\u80fd\u7528\u4e8e\u9875\u5ca9\u6c14\u5f00\u91c7 \u5c71\u4e1c\u58a8\u9f99\u5f3a\u52bf\u4e0a\u6da8 5375bc8c7f949f4338bf4f90 http://stock.eastmoney.com/news/1406,20140516384981846.html\n",
        "\t\u5348\u540e\u5173\u6ce8\u80fd\u5426\u5411\u4e0a\u53cd\u62c9 5374c1677f949f34902c47a5 http://stock.eastmoney.com/news/1406,20140515384659537.html\n",
        "\t\u9707\u8361\u4e0b\u884c \u56db\u7c7b\u80a1\u6210A\u80a1\u201c\u7ede\u8089\u673a\u201d 5374c1927f949f34902c4843 http://stock.eastmoney.com/news/1412,20140515384699145.html\n",
        "\t\u6caa\u6df1B\u6307\u53cc\u53cc\u6536\u8dcc \u6caa\u5e02B\u6307\u8dcc\u5e45\u4e3a0.32% 5374c18a7f949f34902c4827 http://stock.eastmoney.com/news/1432,20140515384726288.html\n",
        "\u4e2d\u56fd\u9a7b\u8d8a\u5357\u5927\u4f7f\u9986\u518d\u6b21\u63d0\u9192\u516c\u6c11\u6ce8\u610f\u4eba\u8eab\u8d22\u4ea7\u5b89\u5168 5374c1397f949f34902c4709\n",
        "\t\u8fdb\u53e3\u539f\u6cb9\u4f7f\u7528\u6743\u7ec6\u5219\u51fa\u53f0\u5728\u5373 \u6709\u6d77\u5916\u8d44\u6e90\u516c\u53f8\u53d7\u76ca 5375bc9e7f949f4338bf4fd6 http://stock.eastmoney.com/news/1406,20140516384920539.html\n",
        "\t\u6caa\u6df1\u4e24\u5e02\u5468\u4e94\u5fae\u5e45\u4f4e\u5f00 \u5238\u5546\u80a1\u9886\u6da8 5375bc877f949f4338bf4f7c http://stock.eastmoney.com/news/1406,20140516384971495.html\n",
        "\t\u7f8e\u56fd5\u6708\u8d39\u57ce\u8054\u50a8\u5236\u9020\u4e1a\u6307\u6570\u964d\u81f315.4 5375bca27f949f4338bf4fe5 http://stock.eastmoney.com/news/1436,20140516384833660.html\n",
        "\u6210\u4ea4\u91cf\u840e\u7f29\u7591\u8bf1\u7a7a \u6295\u8d44\u8005\u9700\u8c28\u614e 5374c14d7f949f34902c4748\n",
        "\u5f20\u88d5B\u88ab\u5254\u9664MSCI\u4e2d\u56fd\u6307\u6570 5374c1617f949f34902c4791\n",
        "\t\u8868\u73b0\u504f\u5f31 \u7b49\u5f85\u65b0\u673a\u4f1a 5375bc837f949f4338bf4f6f http://stock.eastmoney.com/news/1406,20140516385013444.html\n",
        "\u53ca\u65f6\u9501\u5b9a\u90e8\u5206\u76c8\u5229 5374c12c7f949f34902c46fb\n",
        "\t\u660e\u65e5\u4e09\u5927\u731c\u60f3\uff1a\u4e9a\u4fe1\u5cf0\u4f1a\u63a8\u52a8\u5b89\u4fdd\u6982\u5ff5\u5d1b\u8d77 5374c14d7f949f34902c4745 http://stock.eastmoney.com/news/1406,20140515384696325.html\n",
        "\t\u516d\u7c7b\u673a\u6784\u770b\u6cd5\u5206\u6b67 \u673a\u68b0\u533b\u836f\u8ba4\u540c\u5ea6\u9ad8 5375bc997f949f4338bf4fc3 http://stock.eastmoney.com/news/1406,20140516384842053.html\n",
        "\t\u8d44\u672c\u5e02\u573a\u53d1\u5c55\u5173\u7cfb\u7ecf\u6d4e\u53d1\u5c55\u548c\u793e\u4f1a\u7a33\u5b9a\u5927\u5c40 5374c13f7f949f34902c4719 http://stock.eastmoney.com/news/1406,20140515384741241.html\n",
        "\t\u9884\u9632\u5f0f\u62c9\u5347\u6210\u5e38\u6001 \u8010\u5fc3\u4f4e\u5438\u4e00\u7c7b\u80a1 5375bc577f949f4338bf4f0f http://stock.eastmoney.com/news/1405,20140516385046727.html\n",
        "\t\u5bbd\u5e26\u4e2d\u56fd\u5168\u65b0\u84dd\u56fe\u786e\u5b9a 10\u80a1\u6700\u5927\u8d62\u5bb6 5374c17e7f949f34902c47fa http://stock.eastmoney.com/news/1406,20140515384581321.html\n",
        "\t\u623f\u5730\u4ea7\u677f\u5757\u5c0f\u5e45\u4e0a\u6da8 \u540c\u8fbe\u521b\u4e1a\u903c\u8fd1\u6da8\u505c 5375bc857f949f4338bf4f76 http://stock.eastmoney.com/news/1406,20140516385019949.html\n",
        "\t\u5341\u5927\u673a\u6784\u9884\u6d4b\u5927\u52bf\uff1a2050\u70b9\u538b\u529b\u91cd\u91cd 5374c1587f949f34902c476c http://stock.eastmoney.com/news/1406,20140515384606956.html\n",
        "\t\u4ece\u53d6\u6d88\u7ea2\u5229\u7a0e\u5370\u82b1\u7a0e\u5f00\u59cb 5374c15f7f949f34902c4789 http://stock.eastmoney.com/news/1406,20140515384625284.html\n",
        "\t\u660e\u65e5\u6700\u5177\u7206\u53d1\u529b6\u5927\u725b\u80a1\u540d\u5355 5374c13b7f949f34902c470d http://stock.eastmoney.com/news/1406,20140515384738024.html\n",
        "\t\u6838\u7535\u5168\u9762\u5f00\u5de5\u7bad\u5728\u5f26\u4e0a 12\u80a1\u91cd\u5927\u673a\u9047 "
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "5374c17b7f949f34902c47ef http://stock.eastmoney.com/news/1406,20140515384563931.html\n",
        "\t\u6768\u6770\u79d1\u6280\u9006\u52bf\u6da8\u505c \u80a1\u4ef7\u521b\u4e0a\u5e02\u4ee5\u6765\u65b0\u9ad8 5374c1467f949f34902c472c http://stock.eastmoney.com/news/1406,20140515384681567.html\n",
        "\t8\u53ea\u80a1\u7968\u83ab\u540d\u8df3\u6c34 \u81ea\u7136\u4eba\u80a1\u4e1c\u633a\u624e\u773c 5375bc947f949f4338bf4fb1 http://stock.eastmoney.com/news/1406,20140516384843864.html\n",
        "\t\u4e09\u56e0\u7d20\u5de6\u53f3\u80a1\u6307\u4e0d\u524d  \u4e00\u5927\u5229\u597d\u6216\u6210\u50ac\u5316\u5242 5374c1567f949f34902c4765 http://stock.eastmoney.com/news/1406,20140515384605364.html\n",
        "\t\u80a1\u6307\u5e95\u90e8\u53cd\u590d\u9707\u8361 \u4e2d\u7ebf\u53ef\u9022\u4f4e\u5e03\u5c40 5374c12c7f949f34902c46fe http://stock.eastmoney.com/news/1412,20140515384643384.html\n",
        "\t\u6caa\u6df1\u4e24\u5e02\u65e9\u76d8\u5f31\u52bf\u9707\u8361 \u8dcc\u78345\u65e5\u5747\u7ebf 5374c1657f949f34902c479d http://stock.eastmoney.com/news/1406,20140515384644786.html\n",
        "\t\u6caa\u6307\u8dcc1.12%\u783410\u65e5\u7ebf \u4e3b\u529b\u7838\u76d8\u85cf\u771f\u6b63\u610f\u56fe 5374c1b97f949f34902c48b2 http://stock.eastmoney.com/news/1407,20140515384717024.html\n",
        "\t\u91d1\u9f99\u9c7c\u6bcd\u516c\u53f8\u88ab\u66dd\u8d2d\u5730\u6c9f\u6cb9 \u65b9\u4fbf\u9762\u540d\u4f01\u96c6\u4f53\u53d7\u632b 5374c1477f949f34902c4732 http://stock.eastmoney.com/news/1406,20140515384684071.html\n",
        "\t\u64cd\u76d8\u5fc5\u8bfb 5\u670815\u65e5\u8bc1\u5238\u5e02\u573a\u8981\u95fb 5374c16f7f949f34902c47c2 http://stock.eastmoney.com/news/1406,20140515384456267.html\n",
        "\t\u65b0\u56fd\u4e5d\u6761\u5229\u597d\u6709\u9650 \u671f\u6307\u4e0a\u884c\u5c06\u4e00\u6ce2\u4e09\u6298 5374c1787f949f34902c47e6 http://stock.eastmoney.com/news/1406,20140515384522249.html\n",
        "\t121\u5bb6\u516c\u53f8\u5c06\u5206\u7ea2 \u4ebf\u5143\u5927\u5355\u8ffd\u636722\u53ea\u9ad8\u9001\u8f6c\u80a1 5374c1a27f949f34902c4880 http://stock.eastmoney.com/news/1344,20140515384466724.html\n",
        "\t\u6e38\u8d44\u52a0\u4ed3 \u9732\u7b11\u79d1\u6280\u5237\u65b0\u4e0a\u5e02\u65b0\u9ad8 5374c1787f949f34902c47e5 http://stock.eastmoney.com/news/1406,20140515384551124.html\n",
        "\t2000\u70b9\u4fdd\u536b\u6218\u7559\u60ac\u5ff5 5375bc7f7f949f4338bf4f64 http://stock.eastmoney.com/news/1406,20140516385004825.html\n",
        "\tA\u80a1\u586b\u6743\u884c\u60c5\u5f3a\u52bf\u6253\u54cd \u7784\u51c6\u9ad8\u9001\u8f6c4\u80a1\u6b63\u5f53\u65f6 5375bc9d7f949f4338bf4fd3 http://stock.eastmoney.com/news/1406,20140516384881388.html\n",
        "\t\u5f71\u5b50\u94f6\u884c\u4f1a\u8d2f\u7a7f\u4e2d\u56fd\u5229\u7387\u5e02\u573a\u5316\u7684\u5168\u7a0b 5375bc597f949f4338bf4f10 http://stock.eastmoney.com/news/1406,20140516385020425.html\n",
        "\t\u5e02\u573a\u6d41\u52a8\u6027\u5411\u597d\u683c\u5c40\u6599\u4ecd\u5c06\u6301\u7eed 5374c19c7f949f34902c4867 http://stock.eastmoney.com/news/1406,20140515384777079.html\n",
        "\t\u201c\u7164\u98de\u8272\u821e\u201d\u96be\u6301\u7eed \u954d\u4ef7\u4ecd\u6709\u51b2\u9ad8\u673a\u4f1a 5375bc937f949f4338bf4fac http://stock.eastmoney.com/news/1406,20140516384842677.html\n",
        "\t\u6c7d\u8f66\u884c\u4e1a\u5468\u62a5\uff1a4\u6708\u9500\u91cf\u5b63\u8282\u6027\u4e0b\u964d 5374c1977f949f34902c4855 http://stock.eastmoney.com/news/1421,20140515384713682.html\n",
        "\t\u906d\u4e3b\u529b\u51fa\u9003 10\u80a1\u73b0\u65ad\u5d16\u5f0f\u4e0b\u8dcc 5375bc9c7f949f4338bf4fcd http://stock.eastmoney.com/news/1406,20140516384872647.html\n",
        "\t\u6210\u4ea4\u91cf\u7f29\u5f97\u5389\u5bb3 \u5173\u6ce8\u4e1d\u7ef8\u4e4b\u8def\u56fd\u4f01\u6539\u9769\u7b49\u4e3b\u9898 5374c1747f949f34902c47d7 http://stock.eastmoney.com/news/1406,20140515384480512.html\n",
        "\t\u6b63\u5e38\u8c03\u6574 \u5bfb\u627e\u9022\u4f4e\u56de\u8865\u673a\u4f1a 5374c1707f949f34902c47c8 http://stock.eastmoney.com/news/1406,20140515384477756.html\n",
        "\t5\u5927\u5238\u554615\u65e5\u770b\u597d6\u677f\u575729\u80a1 5374c1747f949f34902c47d4 http://stock.eastmoney.com/news/1406,20140515384482244.html\n",
        "\t\u5238\u5546\u80a1\u5168\u7ebf\u98d8\u7eff \u56fd\u5143\u8bc1\u5238\u9886\u8dcc 5374c1607f949f34902c478c http://stock.eastmoney.com/news/1406,20140515384633735.html\n",
        "\t\u53cc\u661f\u95ea\u8000\u5f00\u542f\u53d8\u76d8\u7a97\u53e3 \u4e09\u5927\u5236\u7ea6\u56e0\u7d20\u5f85\u7a81\u7834 5374c1707f949f34902c47c6 http://stock.eastmoney.com/news/1406,20140515384476423.html\n",
        "\t\u7f8e\u80a1\u5468\u4e09\u6536\u4f4e \u9053\u6307\u7ed3\u675f\u4e94\u8fde\u6da8 5374c1837f949f34902c480c http://stock.eastmoney.com/news/1436,20140515384451990.html\n",
        "\t(05/15)\u665a\u95f4\u6caa\u6df1\u4e0a\u5e02\u516c\u53f8\u91cd\u5927\u4e8b\u9879\u516c\u544a\u6700\u65b0\u5feb\u9012 5374c12d7f949f34902c4700 http://stock.eastmoney.com/news/1398,20140515384728063.html\n",
        "\t\u4e24\u5e02\u4f4e\u5f00\u6caa\u6307\u8dcc0.14 \u5238\u5546\u4fdd\u9669\u6da8\u5e45\u5c45\u524d 5375bc877f949f4338bf4f7e http://stock.eastmoney.com/news/1406,20140516384973939.html\n",
        "\u5173\u6ce8\u53d7\u76ca\u653f\u7b56\u7684\u7ee9\u4f18\u80a1 5374c1317f949f34902c4701\n",
        "\t\u6392\u9664\u201c\u5730\u96f7\u201d\u5c06\u6709\u4e00\u6ce2\u7ea0\u9519\u884c\u60c5 5375bcb17f949f4338bf501b http://stock.eastmoney.com/news/1412,20140516385012675.html\n",
        "\t\u6bd4\u66b4\u8dcc\u66f4\u8ba9\u4eba\u53ef\u6015 \u4e3b\u529b\u60ca\u73b0\u53e6\u7c7b\u5c60\u6740\u65b0\u624b\u6cd5 5375bc977f949f4338bf4fbc http://stock.eastmoney.com/news/1406,20140516384864482.html\n",
        "\t\u5f3a\u538b\u4e4b\u4e0b\u53cd\u5f39\u865a\u6643\u4e00\u67aa 5374c14e7f949f34902c474c http://stock.eastmoney.com/news/1406,20140515384708177.html\n",
        "\t\u8000\u76ae\u73bb\u7483\u9009\u4e3e\u8d75\u5065\u4e3a\u8463\u4e8b\u957f 5374c1427f949f34902c4723 http://stock.eastmoney.com/news/1406,20140515384743663.html\n",
        "\t\u518d\u6b21\u6d4b\u8bd52000\u70b9\u652f\u6491 5375bcac7f949f4338bf5008 http://stock.eastmoney.com/news/1413,20140516384861820.html\n",
        "\t\u954d\u4ef7\u91cd\u632b4.5% \u534e\u6cfd\u94b4\u954d\u8dcc\u505c 5374c1817f949f34902c4804 http://stock.eastmoney.com/news/1406,20140515384591973.html\n",
        "\t\u521b\u4e1a\u677f\u91cd\u632b \u7f29\u91cf\u9707\u8361\u6210\u4e3b\u529b\u8bd5\u91d1\u77f3 5375bca97f949f4338bf5000 http://stock.eastmoney.com/news/1451,20140516385012124.html\n",
        "\t\u4e0a\u4ea4\u6240\u8868\u6001\u4e3a\u884c\u60c5\u7eed\u547d \u53cc\u661f\u85cf\u91cd\u5927\u53d8\u76d8\u4fe1\u53f7 5374c1767f949f34902c47df http://stock.eastmoney.com/news/1406,20140515384514715.html\n",
        "\t\u521b\u4e1a\u677f\u6307\u6570\u518d\u6b21\u4e0b\u632b\u903e1% \u521b\u5e74\u5185\u65b0\u4f4e 5375bc8c7f949f4338bf4f92 http://stock.eastmoney.com/news/1406,20140516384978966.html\n",
        "\t\u5e02\u573a\u5c06\u518d\u5ea6\u8003\u9a8c2000\u70b9\u652f\u6491\uff1f 5375bc8f7f949f4338bf4f9f http://stock.eastmoney.com/news/1406,20140516384993331.html\n",
        "\t\u77ed\u671f\u5f31\u52bf\u9707\u8361\u683c\u5c40\u5b58\u5728\u5ef6\u7eed 5374c1567f949f34902c4764 http://stock.eastmoney.com/news/1406,20140515384604454.html\n",
        "\t\u4e07\u90a6\u8fbe\u62df\u975e\u516c\u5f00\u53d1\u884c1620\u4e07\u80a1 \u590d\u724c\u80a1\u4ef7\u903c\u8fd1\u8dcc\u505c 5374c1487f949f34902c4733 http://stock.eastmoney.com/news/1406,20140515384595280.html\n",
        "\t\u5929\u6d25\u4eba\u5747\u6536\u5165\u5c45\u5168\u56fd\u4e4b\u9996 GDP\u5c06\u4e8e2015\u5e74\u8d85\u8d8a\u9999\u6e2f 5375bc9f7f949f4338bf4fd9 http://stock.eastmoney.com/news/1406,20140516384948888.html\n",
        "\t\u591a\u4f26\u80a1\u4efd\u906d\u5927\u80a1\u4e1c\u9999\u6e2f\u591a\u4f26\u51cf\u63011000\u4e07\u80a1 5374c13a7f949f34902c470a http://stock.eastmoney.com/news/1406,20140515384736895.html\n",
        "\t2000\u70b9\u4fdd\u536b\u6218\u7559\u60ac\u5ff5 5375bc7f7f949f4338bf4f64 http://stock.eastmoney.com/news/1406,20140516385004825.html\n",
        "\t5\u670815\u65e5\u5f02\u52a8\u80a1\u70b9\u8bc4 \u76d8\u70b9\u56db\u725b\u4e0e\u56db\u718a 5374c1517f949f34902c4752 http://stock.eastmoney.com/news/1406,20140515384715716.html\n",
        "\t\u5b9d\u5229\u6765\u201c\u8c6a\u8d4c\u201d\u624b\u6e38 \u80a1\u4ef7\u63a5\u8fd1\u6da8\u505c\u5f00\u76d8 5374c1807f949f34902c4803 http://stock.eastmoney.com/news/1406,20140515384587670.html\n",
        "\t\u5b9d\u5229\u6765\u8c6a\u8d4c\u624b\u6e38 \u80a1\u4ef7\u8dcc\u540e\u518d\u8dcc 5375bc7e7f949f4338bf4f5e http://stock.eastmoney.com/news/1406,20140516385003123.html\n",
        "\t\u8fd9\u662f\u975e\u5e38\u5f31\u52bf\u7684\u8868\u73b0 \u51cf\u4ed3\u89c2\u671b 5374c1657f949f34902c479b http://stock.eastmoney.com/news/1406,20140515384648594.html\n",
        "\u7f8e\u8d22\u4ea7\u516c\u5f00\u6cd5\u6216\u5f15\u53d1\u201c\u9000\u7c4d\u6f6e\u201d 5374c1337f949f34902c4704\n",
        "\u5468\u56db\u7968\u636e\u8f6c\u8d34\u5229\u7387\u548c\u7968\u636e\u76f4\u8d34\u5229\u7387\u4f01\u7a33\u53cd\u5f39 5374c1397f949f34902c4708\n",
        "\u65b0\u201c\u56fd\u4e5d\u6761\u201d\u7684\u6838\u5fc3\u662f\u79ef\u6781\u7a33\u59a5\u63a8\u52a8\u6ce8\u518c\u5236\u6539\u9769"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " 5374c13f7f949f34902c471b\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Article.find_one({\"_id\":ObjectId('5374c1267f949f34902c46f1')})"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "ename": "NameError",
       "evalue": "name 'ObjectId' is not defined",
       "output_type": "pyerr",
       "traceback": [
        "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
        "\u001b[1;32m<ipython-input-16-e2a4741c92aa>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mArticle\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfind_one\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m{\u001b[0m\u001b[1;34m\"_id\"\u001b[0m\u001b[1;33m:\u001b[0m\u001b[0mObjectId\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'5374c1267f949f34902c46f1'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
        "\u001b[1;31mNameError\u001b[0m: name 'ObjectId' is not defined"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "type(Article.find_one()['_id'])"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 20,
       "text": [
        "bson.objectid.ObjectId"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "bson.objectid.ObjectId('5374c1267f949f34902c46f1')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 25,
       "text": [
        "ObjectId('5374c1267f949f34902c46f1')"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}